package com.mingrisoft.writenumber;

import android.app.Activity;
import android.content.Intent;
import android.media.MediaPlayer;
import android.os.Bundle;
import android.view.View;

public class SelectActivity extends Activity {
    MediaPlayer mediaPlayer;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout. activity_select);
        if (MainActivity.isPlay==true){
            PlayMusic();
        }

    }
    private void PlayMusic() {

        mediaPlayer = MediaPlayer.create(this, R.raw.number_music);
        mediaPlayer.setLooping(true);
        mediaPlayer.start();
    }


    protected void onStop() {
        super.onStop();
        if (mediaPlayer != null) {
            mediaPlayer.stop();
        }
    }


    protected void onDestroy() {
        super.onDestroy();
        if (mediaPlayer != null) {
            mediaPlayer.release();
            mediaPlayer = null;
        }
    }


    protected void onRestart() {
        super.onRestart();
        if (MainActivity.isPlay == true) {
            PlayMusic();
        }
    }
    public void OnOne(View v){
        startActivity(new Intent(SelectActivity.this, OneActivity.class));
    }
    public void OnTwo(View v){
        //当前界面跳转至数字2书写界面
        startActivity(new Intent(SelectActivity.this, TwoActivity.class));
    }
    public void OnThree(View v){   //单击事件  进入数字3书写界面
        //当前界面跳转至数字3书写界面
        startActivity(new Intent(SelectActivity.this, ThreeActivity.class));
    }
    public void OnFour(View v){   //单击事件  进入数字4书写界面
        //当前界面跳转至数字4书写界面
        startActivity(new Intent(SelectActivity.this, FourActivity.class));
    }
    public void OnFive(View v){   //单击事件  进入数字5书写界面
        //当前界面跳转至数字5书写界面
        startActivity(new Intent(SelectActivity.this, FiveActivity.class));
    }
    public void OnSix(View v){   //单击事件  进入数字6书写界面
        //当前界面跳转至数字6书写界面
        startActivity(new Intent(SelectActivity.this, SixActivity.class));
    }
    public void OnSeven(View v){   //单击事件  进入数字7书写界面
        //当前界面跳转至数字7书写界面
        startActivity(new Intent(SelectActivity.this, SevenActivity.class));
    }
    public void OnEight(View v){   //单击事件  进入数字8书写界面
        //当前界面跳转至数字8书写界面
        startActivity(new Intent(SelectActivity.this, EightActivity.class));
    }
    public void OnNine(View v){   //单击事件  进入数字9书写界面
        //当前界面跳转至数字9书写界面
        startActivity(new Intent(SelectActivity.this, NineActivity.class));
    }
    public void OnZero(View v){   //单击事件  进入数字8书写界面
        //当前界面跳转至数字8书写界面
        startActivity(new Intent(SelectActivity.this, ZeroActivity.class));
    }
}   //SelectActivity类尾部

